package com.heima.comment.controller;

import com.heima.comment.service.CommentRepayService;
import com.heima.model.comment.dtos.CommentLikeDto;
import com.heima.model.comment.dtos.CommentRepayDto;
import com.heima.model.comment.dtos.CommentRepayLikeDto;
import com.heima.model.comment.dtos.CommentRepaySaveDto;
import com.heima.model.common.dtos.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/comment_repay")
@Slf4j
public class CommentRepayController {
    @Autowired
    private CommentRepayService commentRepayService;
    //二级评论新增
    @PostMapping("/save")
    public ResponseResult save(@RequestBody CommentRepaySaveDto dto){
        return  commentRepayService.save(dto);
    }
    //二级评论查询
    @PostMapping("/load")
    public ResponseResult load(@RequestBody CommentRepayDto dto){
        log.info("二级评论查询接收参数=========={}",dto);
      return   commentRepayService.load(dto);
    }
    //二级评论点赞
    @PostMapping("/like")
    public ResponseResult like(@RequestBody CommentRepayLikeDto dto){
        return commentRepayService.like(dto);
    }
}
